/* 
 * Copyright (C) 2012 Martin Řehánek <rehan at mzk.cz>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * This track is used for debugging without Fedora and Kramerius present
 */

goog.provide('kramerius.audio.DebugTrack');
goog.require('kramerius.audio.AbstractTrack');

/**
 * @constructor 
 * @param {!string} id Unique identifier of the track.
 * @param {!string} title Name of the track.
 * @param {!string} length Length of the track
 * @param {!string} baseUrl Base url of the web server.
 * @param {string|null} mp3File in the web server, i.e. absolute url of mp3 file is baseUrl + mp3File
 * @param {string|null} oggFile in the web server, i.e. absolute url of ogg file is baseUrl + mp3File
 * 
 */
kramerius.audio.DebugTrack = function (id, title, length, baseUrl, mp3File, oggFile){
    kramerius.audio.AbstractTrack.call(this, id, title, length);
    this.baseUrl_ = baseUrl;
    this.mp3File_ = mp3File;
    this.oggFile_ = oggFile;
}
goog.inherits(kramerius.audio.DebugTrack, kramerius.audio.AbstractTrack);

/**
 * @return {Array.<string>}Array of urls in different format usable by soundmanager.
 */
kramerius.audio.DebugTrack.prototype.urlArray = function(){
    if (this.mp3File_ != null && this.oggFile_ != null){
        var mp3Url = this.baseUrl_ + this.mp3File_;
        var oggUrl = this.baseUrl_ + this.oggFile_;
        return [oggUrl,mp3Url];  
    } else if (this.mp3File_ != null){
        return [this.baseUrl_ + this.mp3File_];
    } else if (this.oggFile_ != null){
        return [this.baseUrl_ + this.oggFile_];
    } else{
        return []
    }
};
